﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApp2
{
    public class DbHelper
    {
       public static DataTable GetDataTable(string sql)
        {
            string conString = "server=.;database=School;uid=sa;pwd=123456";
            

            SqlConnection connection = new SqlConnection(conString);

            SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);

            connection.Open();

            DataTable dt = new DataTable();

            adapter.Fill(dt);

            return dt;
        }

        public  static  int AddOrUpdate(string sql)
        {
            sqlConnection connection = new sqlConnection(connection);

            SqlConnection conmmand = new SqlCommand(sql, connection);

            connection.Open();

            return command.ExecuteNonQuery();

        }
    }
}
